<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ page import="com.milk.entity.Stock" %>
<%@ page import="java.util.List" %>
<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>低库存预警</title>
    <style>
        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
        }

        body {
            font-family: Arial, sans-serif;
            display: flex;
            justify-content: center;
            align-items: center;
            min-height: 100vh;
            background: linear-gradient(90deg, #ff9a9e, #fad0c4);
            padding: 20px;
        }

        .container {
            background: #fff;
            border-radius: 10px;
            box-shadow: 0 14px 28px rgba(0, 0, 0, 0.25), 0 10px 10px rgba(0, 0, 0, 0.22);
            padding: 30px;
            width: 90%;
            max-width: 800px;
        }

        h3 {
            color: #333;
            text-align: center;
            margin-bottom: 20px;
            font-size: 24px;
        }

        table {
            width: 100%;
            border-collapse: collapse;
            background-color: #fff;
            border-radius: 8px;
            overflow: hidden;
            box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
        }

        th, td {
            padding: 15px;
            text-align: center;
            border-bottom: 1px solid #ddd;
        }

        th {
            background-color: #ff4b2b;
            color: white;
            font-weight: bold;
        }

        tr:hover {
            background-color: #f9f9f9;
        }

        .no-data {
            text-align: center;
            color: #888;
            font-style: italic;
            padding: 20px;
        }

        .return-button {
            display: inline-block;
            margin-top: 20px;
            padding: 12px 24px;
            background-color: #6c757d;
            color: white;
            text-decoration: none;
            border-radius: 20px;
            transition: background-color 0.3s ease;
            text-align: center;
            width: 100%;
            max-width: 200px;
            margin-left: auto;
            margin-right: auto;
            display: block;
            border: 1px solid #6c757d;
            font-size: 12px;
            font-weight: bold;
            letter-spacing: 1px;
            text-transform: uppercase;
        }

        .return-button:hover {
            background-color: #5a6268;
        }

        @media (max-width: 600px) {
            .container {
                padding: 20px;
            }

            th, td {
                padding: 10px;
            }

            h3 {
                font-size: 20px;
            }

            .return-button {
                padding: 10px 20px;
                font-size: 14px;
            }
        }
    </style>
</head>
<body>
<div class="container">
    <h3>低库存预警</h3>
    <table>
        <thead>
        <tr>
            <th>饮品ID</th>
            <th>当前库存数量</th>
            <th>库存预警阈值</th>
        </tr>
        </thead>
        <tbody>
        <%
            List<Stock> lowStockList = (List<Stock>) request.getAttribute("lowStockList");
            if (lowStockList != null && !lowStockList.isEmpty()) {
                for (Stock stock : lowStockList) {
        %>
        <tr>
            <td><%= stock.getDrinkId() %></td>
            <td><%= stock.getQuantity() %></td>
            <td><%= stock.getLowStockThreshold() %></td>
        </tr>
        <%
            }
        } else {
        %>

        <tr>
            <td colspan="3" class="no-data">没有低库存预警信息</td>
        </tr>
        <%
            }
        %>
        </tbody>
    </table>
    <br>
    <a href="<%= request.getContextPath() %>/stock/viewAll" class="return-button">返回库存列表</a>
</div>
</body>
</html>